//
//  HamatonLoginViewModel.swift
//  grid-ios-app
//
//  Created by wondertek on 2024/3/22.
//

import UIKit

enum LoginType {
    case passwordType
    case oneKeyType
}
class HamatonLoginViewModel {

    public var userName: String = ""
    public var userPassword: String = ""
    public var type: LoginType = .passwordType
    public var oneKeyName: String = ""
    public var isAgree: Bool = false
    
     public func jundgeIsLogin() -> String? {
        if isAgree {
            if(type == .passwordType) {
                if self.userName.count <= 0 || self.userName.count > 12 {
                    return "请输入用户名"
                }
                
                if self.userPassword.count <= 0 || self.userPassword.count > 12 {
                    return "请输入密码"
                }
                return nil
            }
            else {
                if self.oneKeyName.count <= 0 || self.oneKeyName.count > 12 {
                    return "请输入"
                }
                return nil
            }
            
        }
        return "请同意协议"
    }
}
